package com.aaa.javaweb.servlet;

import com.aaa.javaweb.dao.ZongDao;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Array;
import java.util.*;

@RestController
@RequestMapping("zongji")
public class ZongjiController {
    @Autowired
    private ZongDao zongDao;
    @RequestMapping("getZong")
    public Map zong(){
        Map maps=zongDao.getzong();
        return maps;

    }
    @RequestMapping("gettype")
    public List<Map> gettype(){
        List<Map> getzong = zongDao.gettype();
        List list= new ArrayList<>();
        for (int i = 0; i <getzong.size() ; i++) {

            Map map = new HashMap();
            map.put("value",getzong.get(i).get("value"));
            map.put("name",getzong.get(i).get("tname"));
            list.add(map);
        }
        System.out.println(list.size());
        /*for (Map map : getzong) {
            int  value = Integer.parseInt(map.get("value")+"");
            System.out.println("=========="+value);
        }*/

        return list;
    }


}
